import React, { Component } from 'react';
import Header from './components/Header';
import Home from './components/Home';
import About from './components/About';
import { NavLink, Route } from 'react-router-dom';


export default class App extends Component {
    render() {
        return (
            <div>
                <Header />

                <div className="row">
                    <div className="col-xs-2 col-xs-offset-2">
                        <div className="list-group">

                            {/* 在React中，是Link组件（路由链接）完成路径切换，to属性是用来切换路径的 */}
                            {/*  <a className="list-group-item active" href="./about.html">About</a>
                            <a className="list-group-item" href="./home.html">Home</a> */}

                            <NavLink activeClassName='active' className="list-group-item " to='/about' >About</NavLink>
                            <NavLink activeClassName='active' className="list-group-item" to='/home'>Home</NavLink>
                        </div>
                    </div>
                    <div className="col-xs-6">
                        <div className="panel">
                            <div className="panel-body">

                                {/* route标签是路由的切换实现，path属性是用来监听路径，然后路径匹配成功则加载对应的组件,component属性后跟当前要加载的组件 */}
                                {/*  <Home />
                                <About /> */}
                                <Route path='/about' component={About} />
                                <Route path='/home' component={Home} />
                            </div>
                        </div>
                    </div>
                </div>
            </div >
        )
    }
}
